If else statement in R programming